Learn R Programming

ibmdbR (version 1.34.3)

idaDeleteTable, idaExistTable, idaGetValidTableName: Miscellaneous tools

Description

These functions simplify working with database tables.

Usage

idaDeleteTable(table)

idaExistTable(tableName)

idaIsView(tableName)

idaGetValidTableName(prefix="DATA_FRAME_")

Arguments

table
The name of a database table or a ida.data.frame.
tableName
The name of a database table.
prefix
Keyword used to specify the prefix of a table name.

Value

  • The idaDeleteTable function does not return a value. The idaExistTable function returns a logical value (TRUE or FALSE) that indicates whether the specified table exists in the database. The idaGetValidTableName function returns a string representing a table name.

Details

Use the idaDeleteTable function to drop the specified table. The specified table must exist in the current database. Use the idaExistTable function to determine whether the specified table exists in the database. Use the idaGetValidTableName function to obtain a table name that is not yet in use. This name will be the specified or default prefix followed by a number, for example, data_frame_7.

Examples

Run this code
#Check whether a table with a given name exists
idaExistTable('DB2INST1.SHOWCASE_SYSTEMS')

#Create a pointer to the table
bdf <- ida.data.frame('DB2INST1.SHOWCASE_SYSTEMS')

#Obtain a unique table name for the copy
copyTableName <- idaGetValidTableName(prefix = "COPY_")

#Create a copy of the original table
bdfCopy <- 
  as.ida.data.frame(as.data.frame(bdf),copyTableName,clear.existing=TRUE, case.sensitive=TRUE)

#Delete the copy
idaDeleteTable(copyTableName)

Run the code above in your browser using DataLab